采用全连接神经网络对012345的手势图片进行识别,基于Pytorch编写,附h5格式数据集
class Net(nn.Module):
def __init__(self, n_inputs, n_hidden_1, n_hidden_2, n_outputs):
super(Net, self).__init__()
self.fc = nn.Sequential(
nn.Linear(n_inputs, n_hidden_1), nn.BatchNorm1d(n_hidden_1), nn.ReLU(),
nn.Linear(n_hidden_1, n_hidden_2), nn.BatchNorm1d(n_hidden_2), nn.ReLU(),
nn.Linear(n_hidden_2, n_outputs)
)
def forward(self, x):
output = self.fc(x)
return output
评论